import axios from "axios";
import cookie from 'js-cookie';
import Vue from 'vue';
import vueRouter from 'vue-router';
//创建axios实例
// http request 拦截器
Vue.use(vueRouter)
axios.interceptors.request.use(
    config => {
        //debugger
        if (cookie.get('erpDongAn-user')) {
            config.headers['token'] = cookie.get('erpDongAn-user');
        }else {
            console.log("未登录")
         //未登录则跳转登录页面
           // window.location.href="/";
        }
        return config
    },
    err => {
        console.log("失败!")
        return Promise.reject(err);
    });
